package com.site.service.impl.master;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.site.dao.master.CityDao;
import com.site.dto.master.CityBizBean;
import com.site.model.master.CityInfo;
import com.site.service.master.CityService;
import com.site.util.PropertyUtils;
import com.site.util.base.service.BaseServiceImpl;
import com.site.util.exception.ApplicationException;
import com.site.util.exception.SystemException;

/**
 * 城市Service
 * 
 * @author lee
 * @date 2013年11月7日
 */
@Component
public class CityServiceImpl extends BaseServiceImpl implements CityService {

	public CityDao cityDao;

	@Resource
	public void setCityDao(CityDao cityDao) {
		this.cityDao = cityDao;
	}

	public List<CityBizBean> getCitys(CityBizBean vo) {
		List<CityInfo> cityInfos = cityDao.getCitys(vo);
		if (cityInfos != null && cityInfos.size() > 0) {
			List<CityBizBean> cityBizBeans = new ArrayList<CityBizBean>();
			for (CityInfo cityInfo : cityInfos) {
				if (null != cityInfo) {
					CityBizBean cityBizBean = new CityBizBean();
					PropertyUtils.copyProperties(cityBizBean, cityInfo);
					cityBizBeans.add(cityBizBean);
				}
			}
			if (null != cityBizBeans && cityBizBeans.size() > 0) {
				return cityBizBeans;
			}
		}
		return null;
	}

	@Override
	public Object doExecute(Object obj, String command) throws SystemException,
			ApplicationException {
		// TODO Auto-generated method stub
		return null;
	}

}
